package com.locus.tools.location;

import android.content.Intent;
import android.location.Location;

import com.locus.tools.LocusConstants;
import com.locus.tools.xmpp.ISendable;

public class GPSResponse implements ISendable {

	private String locationMsg;
	private String to;
	private String from;
	
	
	public GPSResponse(Location loc, String to, String from) {
		double lat = loc.getLatitude();
		double lon = loc.getLongitude();
		
		locationMsg = lat + "," + lon + ";"; 
		this.to = to;
		this.from = from;
	
	}
	
	
	@Override
	public String getMessage() {
		return locationMsg;
	}

	@Override
	public String getRecipient() {
		return to;
	}

	@Override
	public String getSender() {
		return from;
	}


	@Override
	public Intent createIntent() {
		Intent it = new Intent();
		// build the intent
		it.addCategory(LocusConstants.GPS_Response);
		it.putExtra(LocusConstants.TO_FIELD, to);
		it.putExtra(LocusConstants.FROM_FIELD, from);
		it.putExtra(LocusConstants.MSG_FIELD, locationMsg);
		return it;
	}

}
